package com.sim.simserial.view

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import com.drake.brv.utils.addModels
import com.drake.brv.utils.linear
import com.drake.brv.utils.setup
import com.sim.simserial.R
import com.sim.simserial.databinding.ViewRvBinding
import com.sim.simserial.databinding.ViewSizeBinding

class LogView(context: Context, attrs: AttributeSet) : RelativeLayout(context, attrs) {
    var mBinding: ViewRvBinding

    init {
        mBinding = ViewRvBinding.inflate(LayoutInflater.from(context))
        addView(mBinding.root, RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)

        mBinding.rv.linear().setup {
            addType<String>(R.layout.item_log)
        }.models = emptyList()
    }

    fun addItems(log: String) {
        mBinding.rv.addModels(listOf(log))
    }
}